package com.banzhi.shop.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageView;

import com.banzhi.shop.MyApp;
import com.banzhi.shop.R;
import com.banzhi.shop.base.BaseActivity;
import com.banzhi.shop.utils.Translucent;

/**
 * 店铺预览
 */
public class DianpuYulanActivity extends BaseActivity {
    private WebView webView;
    private ImageView ivback;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dianpu_yulan);
        Translucent.setTranslucent(this);
        webView = (WebView) findViewById(R.id.webview);
        ivback = (ImageView) findViewById(R.id.iv_back);
        String str = "http://banzhi.wxmarket.cn/shop/entry/mobile.html?r=commission.myshop&openid=" + MyApp.loginMessage.getString("openid", "") + "&mid=" + MyApp.loginMessage.getString("id", "");
        webView.loadUrl(str);
        //启用支持Javascript
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        ivback.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }

    @Override
    protected void onPause() {
        webView.onPause();
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        webView.destroy();
        super.onDestroy();
    }
}
